<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script>
    var obj = { a: { b: { c: 1 }, d: 2 }, e: 3 }
    function getObject(object, key, result) {
        for (var key1 in object) {
            key.push(key1)
            if (typeof (object[key1]) != 'object') {
                result[key.join('.')] = object[key1]
            } else {
                getObject(object[key1], key, result)
            }
            key.pop()
        }
    }
    function bPing(object) {
        var result2 = {}
        getObject(object, [], result2)
        return result2
    }
    console.log(bPing(obj));
</script>

<body>

</body>

</html>